package com.dm.userservice;

import com.dm.model.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;


@RestController
public class UserService {
    private Logger logger= LoggerFactory.getLogger(UserService.class);

    @GetMapping(value = "/login")
    public String login(){
        System.err.println("测试");
        return "用户验证成功";
    }

    @PostMapping(value = "/login1")
    public boolean login1(@RequestParam("name") String name,@RequestParam("pwd") String pwd){
        System.err.println("测试");
        return true;
    }

    @PostMapping(value = "/login2")
    public boolean login2(@RequestBody User user){
        System.err.println("测试userName:"+user.getUserName());
        return true;
    }

    @PostMapping(value = "/login3")
    public String login3(@RequestParam("count") Integer count){
        logger.info("请求的是 provider 2 8080 端口，请求第 "+ count +"次");
        System.err.println("测试userName:");
        return "连接成功1请求第 "+ count +"次";
    }

}